<?php
/**
 * Created by PhpStorm.
 * User: 悟能科技
 * Date: 2018/5/26
 * Time: 15:03
 */

namespace app\common\controller;


use app\common\model\Faq;
use think\Controller;

class Helpinfo extends Controller
{

    //帮助信息
    /*
     * $type   0 微信报错   /  1  会员卡报错  / 2   API报错  / 3  小程序报错
     *
     * */
    public function gethelpinfo($type,$errcode,$errmsg){
        if (isset($type) && isset($errcode) && isset($errmsg)) {
            $Faq = new Faq();
            $map['type'] = $type;
            $map['keyword'] = $errcode;
            $info = $Faq->where($map)->field('info,wx_info,keyword')->find();
            if (!$info && $errcode!==0){
                $data['type'] = 0;
                $data['wx_info'] = $errmsg;
                $data['keyword'] = $errcode;
                $data['addtime'] = time();
                $Faq->allowField(true)->save($data);
                $info['info'] = $errmsg;
            }
            return $info['info'];
        }

    }

}